package ts.group.webapp.market.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import ts.group.webapp.market.dao.IShopDao;
import ts.group.webapp.market.model.TShopInfo;

import com.starit.common.dao.support.Pagination;
import com.starit.common.dao.support.PaginationRequest;

@Service
public class IShopService {
	
	@Autowired
	private IShopDao IShopDao;
	
	/*查询所有记录*/
	public Pagination<TShopInfo>  findAllForPage(PaginationRequest paginationRequest){
		return IShopDao.findPage(paginationRequest);
	}
	
	/*根据店铺id查询店铺*/
	public TShopInfo getShopById(Long id ){
		return IShopDao.get(id);
	}
	
	/*根据店铺编码查询店铺*/
	public List<TShopInfo> getShopByShopCode(String shopcode){
		return IShopDao.findByNamedParam("shopCode", shopcode);
	}
	
	/*新增店铺*/
	public Long createShop(TShopInfo entity){
		return IShopDao.save(entity);
	}
	
	/*更新店铺*/
	public void updateShop(TShopInfo entity){
		 IShopDao.update(entity);
	}
	
	/*删除店铺*/
	public void removeShop(Long shopId){
		IShopDao.delete(shopId);
	}
	
}
